/*
 * UEC3 Notice 1.0
 * Copyright(c) 2010-2100, Integrated Technologies, Inc.
 * sunpeng@uce3.com
 * 
 * http://www.uce3.com/license
 */

Ext.NoticeAccessor = Ext.extend(Ext.util.Observable, {
   
　　/**
    * 通知队列
    * @type 
    */
   queue: [],
   
   /**
    * 获取通知地址
    * @type 
    */
   url:null,
   
   /**
    * 通知展示样式装饰function
    * @param {} notice
    * @return {}
    */
   decorator : function(notice){
   		return notice;
   },
   
   constructor : function(config){
   		this.url=config.url;
   		this.app=config.app;
   		this.decorator=config.decorator;
   },
   
   /**
    * 暂时作废
    * @return {}
    */
   get: function(params){
   	
   	  var notice=this.queue.shift();
   	  if(notice==null || this.queue.length==0){
	   	  Ext.Ajax.request({
	    		url: this.url,//Uec3.App.Constants.LastNoticeId
	    		params: params,
	    		success: function(o){
	    			if(o.responseText && o.responseText!=""){
		    			eval("var p="+o.responseText);
		    			if(p && p.length && p.length>0){
	    					for(var i=0;i<p.length;i++){
	    						this.queue.push(p[i]);
	    					}
		    			}
		    		}
	    		},
	    		failure: function(){
	    			//alert('访问服务发生错误!');
	    		},
	    		scope: this
	    	});
   	  }
   	  return notice==null?null:this.decorator(notice);
   }

});

Ext.NoticeDetailer = function(obj,noticeId){
	 this.desktop.launchWindowByParam("notice",{id:noticeId});
	 //this.makeRequest("notice",null);
};
